<h1>General Education Plan of Course Work</h1>

<div id="geplan">
	<?php echo form_open('encoder/gePlan');?>
	<?php echo '<b><i>' . form_label('Arts and Humanities (AH) Domain (5)') . '</i></b>';?>
	<table>
		<?php 
			$ctr = 0;
			echo "<tr>";
			foreach($ge_ah as $item){
				if($ctr != 3){	//To setup how many checkboxes are there in a row.
					if($curr_ge != NULL){	//If some GEs are already selected
						foreach($curr_ge as $i){	//Compare the 15 currently selected GEs to the checkbox to be echoed.
							if($i == $item){	//If equal, set it to checked.
								$data = array(
									'name' => 'ge_ah[]',
									'value' => $item,
									'checked' => TRUE,
								);
								break;
							}else{
								$data = array(
									'name' => 'ge_ah[]',
									'value' => $item,
								);
							}
						}
						echo "<td width=90>" . form_checkbox($data) . form_label($item) . "</td>";
					}else{	//If there are still no GEs selected
						$data = array(
							'name' => 'ge_ah[]',
							'value' => $item,
						);
						echo "<td width=90>" . form_checkbox($data) . form_label($item) . "</td>";
					}
					$ctr = $ctr+1;
				}else{
					if($curr_ge != NULL){	//If some GEs are already selected
						foreach($curr_ge as $i){
							if($i == $item){
								$data = array(
									'name' => 'ge_ah[]',
									'value' => $item,
									'checked' => TRUE,
								);
								break;
							}else{
								$data = array(
									'name' => 'ge_ah[]',
									'value' => $item,
								);
							}
						}
						echo "<td width=90>" . form_checkbox($data) . form_label($item) . "</td>";
					}else{	//If there are still no GEs selected
						$data = array(
							'name' => 'ge_ah[]',
							'value' => $item,
						);
						echo "<td width=90>" . form_checkbox($data) . form_label($item) . "</td>";
					}
					echo "</tr>";
					echo "<tr>";
					$ctr = 0;
				}
			}
		?>
	</table>
	<?php echo form_error('ahform'); ?>
	
	</br>
	<?php echo '<b><i>' . form_label('Social Sciences and Philosophy Domain (5)') . '</i></b>';?>
	<table>
		<?php 
			$ctr = 0;
			echo "<tr>";
			foreach($ge_ssp as $item){
				if($ctr != 3){	//To setup how many checkboxes are there in a row.
					if($curr_ge != NULL){	//If some GEs are already selected
						foreach($curr_ge as $i){	//Compare the 15 currently selected GEs to the checkbox to be echoed.
							if($i == $item){	//If equal, set it to checked.
								$data = array(
									'name' => 'ge_ssp[]',
									'value' => $item,
									'checked' => TRUE,
								);
								break;
							}else{
								$data = array(
									'name' => 'ge_ssp[]',
									'value' => $item,
								);
							}
						}
						echo "<td width=90>" . form_checkbox($data) . form_label($item) . "</td>";
					}else{	//If there are still no GEs selected
						$data = array(
							'name' => 'ge_ssp[]',
							'value' => $item,
						);
						echo "<td width=90>" . form_checkbox($data) . form_label($item) . "</td>";
					}
					$ctr = $ctr+1;
				}else{
					if($curr_ge != NULL){	//If some GEs are already selected
						foreach($curr_ge as $i){
							if($i == $item){
								$data = array(
									'name' => 'ge_ssp[]',
									'value' => $item,
									'checked' => TRUE,
								);
								break;
							}else{
								$data = array(
									'name' => 'ge_ssp[]',
									'value' => $item,
								);
							}
						}
						echo "<td width=90>" . form_checkbox($data) . form_label($item) . "</td>";
					}else{	//If there are still no GEs selected
						$data = array(
							'name' => 'ge_ssp[]',
							'value' => $item,
						);
						echo "<td width=90>" . form_checkbox($data) . form_label($item) . "</td>";
					}
					echo "</tr>";
					echo "<tr>";
					$ctr = 0;
				}
			}
		?>
	</table>
	<?php echo form_error('sspform'); ?>
	
	</br>
	<?php echo '<b><i>' . form_label('Mathematics, Science and Technology Domain (5)') . '</i></b>';?>
		<table>
		<?php 
			$ctr = 0;
			echo "<tr>";
			foreach($ge_mst as $item){
				if($ctr != 3){	//To setup how many checkboxes are there in a row.
					if($curr_ge != NULL){	//If some GEs are already selected
						foreach($curr_ge as $i){	//Compare the 15 currently selected GEs to the checkbox to be echoed.
							if($i == $item){	//If equal, set it to checked.
								$data = array(
									'name' => 'ge_mst[]',
									'value' => $item,
									'checked' => TRUE,
								);
								break;
							}else{
								$data = array(
									'name' => 'ge_mst[]',
									'value' => $item,
								);
							}
						}
						echo "<td width=90>" . form_checkbox($data) . form_label($item) . "</td>";
					}else{	//If there are still no GEs selected
						$data = array(
							'name' => 'ge_mst[]',
							'value' => $item,
						);
						echo "<td width=90>" . form_checkbox($data) . form_label($item) . "</td>";
					}
					$ctr = $ctr+1;
				}else{
					if($curr_ge != NULL){	//If some GEs are already selected
						foreach($curr_ge as $i){
							if($i == $item){
								$data = array(
									'name' => 'ge_mst[]',
									'value' => $item,
									'checked' => TRUE,
								);
								break;
							}else{
								$data = array(
									'name' => 'ge_mst[]',
									'value' => $item,
								);
							}
						}
						echo "<td width=90>" . form_checkbox($data) . form_label($item) . "</td>";
					}else{	//If there are still no GEs selected
						$data = array(
							'name' => 'ge_mst[]',
							'value' => $item,
						);
						echo "<td width=90>" . form_checkbox($data) . form_label($item) . "</td>";
					}
					echo "</tr>";
					echo "<tr>";
					$ctr = 0;
				}
			}
		?>
	</table>
	<?php echo form_error('mstform'); ?>
</div>

<!-- Submit Button -->
<?php
	$data = array(
		'value' => 'Save',
	); 
	echo form_submit($data);
?>
<?php echo form_close(); ?>
	
<!-- Cancel Button -->
<?php 
	echo form_open('encoder/view');
		
	$data = array(
		'value' => 'Cancel',
	); 
	echo form_submit($data);
	echo form_close();
?>
<?php echo anchor('encoder/clearGEList/','Delete All Approved GE');?>
	</br>
<?php echo anchor('encoder/index','Back to Home Page');?> </br>
<?php echo anchor('encoder/logout','Logout');?>